<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">

<title>class CGI::Cookie - cgi: Ruby Standard Library Documentation</title>


<script src="../js/navigation.js" defer></script>
<script src="../js/search.js" defer></script>
<script src="../js/search_index.js" defer></script>
<script src="../js/searcher.js" defer></script>
<script src="../js/darkfish.js" defer></script>

<script src="../js/jquery-3.2.0.min.js"></script>

<script src="../js/vue.min.js"></script>
<script src="../js/js.cookie.min.js"></script>

<link href="../css/fonts.css" rel="stylesheet">
<link id='rdoccss' href="../css/rdoc.css" rel="stylesheet">
<link href="../css/carbon17.css" rel="stylesheet">

<script type="text/javascript">
  var rdoc_rel_prefix = "../";
  var index_rel_prefix = "../";
  var darkModeCsseHref = "../css/rdoc-dm.css"
  var defaultModeCssHref = "../css/rdoc.css"
  // var cssDarkmode = Cookies.get('darkmode');
  
  if( Cookies.get("darkmode") == "true") {
	$('#rdoccss').attr("href", darkModeCsseHref);
}

//  https://cssdeck.com/blog/simple-jquery-stylesheet-switcher/

document.write('<style type="text/css">body{display:none}</style>');

</script>


</head>
<body id="top" role="document" class="class">
  <!-- this is class.html -->

  <div id='actionbar' >
    <div class='wrapper mdiv'>
      <ul class='grids g0'></ul>
    </div> 
    <!-- VERSION HEADER for 3.3.0.preview2 NOT FOUND -->
  </div> <!-- end action bar -->

  <div class='wrapper hdiv'>

    


    <nav id='vapp' role="navigation">
    <div id="project-navigation">
      <div id="home-section" role="region" title="Quick navigation" class="nav-section">
  <h2><a href="../index.html" rel="home">Home</a></h2>

  <div id="table-of-contents-navigation"  >
    <a href="../table_of_contents.html#pages">Pages</a>
    <a href="../table_of_contents.html#classes">Classes</a>
    <a href="../table_of_contents.html#methods">Methods</a>
  </div>
</div>

      <div id="search-section" role="search" class="project-section initially-hidden">
  <form action="#" method="get" accept-charset="utf-8">
    <div id="search-field-wrapper">
      <input id="search-field" role="combobox" aria-label="Search"
             aria-autocomplete="list" aria-controls="search-results"
             type="text" name="search" placeholder="Search" spellcheck="false"
             title="Type to search, Up and Down to navigate, Enter to load">
    </div>

    <ul id="search-results" aria-label="Search Results"
        aria-busy="false" aria-expanded="false"
        aria-atomic="false" class="initially-hidden"></ul>
  </form>
</div>

    </div>


    

    <button id='toggleThing' @click="toggleNav()" >Show/hide navigation</button>
    <div :class="isOpen ? 'block' : 'hidden' " id='toggleMe'>
      <div id="class-metadata">
        
        
<div id="parent-class-section" class="nav-section">
  <h3>Parent</h3>

  <p class="link">Array
</div>

        
        
        
<!-- Method Quickref -->
<div id="method-list-section" class="nav-section">
  <h3>Methods</h3>

  <ul class="link-list" role="directory">
    <li class="calls-super" ><a href="#method-c-new">::new</a>
    <li ><a href="#method-c-parse">::parse</a>
    <li ><a href="#method-i-domain-3D">#domain=</a>
    <li ><a href="#method-i-httponly-3D">#httponly=</a>
    <li ><a href="#method-i-inspect">#inspect</a>
    <li ><a href="#method-i-name-3D">#name=</a>
    <li ><a href="#method-i-path-3D">#path=</a>
    <li ><a href="#method-i-secure-3D">#secure=</a>
    <li ><a href="#method-i-to_s">#to_s</a>
    <li ><a href="#method-i-value">#value</a>
    <li ><a href="#method-i-value-3D">#value=</a>
  </ul>
</div>

      </div>
     </div>
    </nav>


    <div id='extraz'><div class='adzbox-index'  >
      
     </div>         
    </div>

    <main role="main" aria-labelledby="class-CGI::Cookie">
    <h1 id="class-CGI::Cookie" class="class">
      class CGI::Cookie
    </h1>

    <section class="description">
    
<p>Class representing an HTTP cookie.</p>

<p>In addition to its specific fields and methods, a <a href="Cookie.html"><code>Cookie</code></a> instance is a delegator to the array of its values.</p>

<p>See RFC 2965.</p>

<h2 id="class-CGI::Cookie-label-Examples+of+use">Examples of use<span><a href="#class-CGI::Cookie-label-Examples+of+use">&para;</a> <a href="#top">&uarr;</a></span></h2>

<pre>cookie1 = CGI::Cookie.new(&quot;name&quot;, &quot;value1&quot;, &quot;value2&quot;, ...)
cookie1 = CGI::Cookie.new(&quot;name&quot; =&gt; &quot;name&quot;, &quot;value&quot; =&gt; &quot;value&quot;)
cookie1 = CGI::Cookie.new(&#39;name&#39;     =&gt; &#39;name&#39;,
                          &#39;value&#39;    =&gt; [&#39;value1&#39;, &#39;value2&#39;, ...],
                          &#39;path&#39;     =&gt; &#39;path&#39;,   # optional
                          &#39;domain&#39;   =&gt; &#39;domain&#39;, # optional
                          &#39;expires&#39;  =&gt; Time.now, # optional
                          &#39;secure&#39;   =&gt; true,     # optional
                          &#39;httponly&#39; =&gt; true      # optional
                          )

cgi.out(&quot;cookie&quot; =&gt; [cookie1, cookie2]) { &quot;string&quot; }

name     = cookie1.name
values   = cookie1.value
path     = cookie1.path
domain   = cookie1.domain
expires  = cookie1.expires
secure   = cookie1.secure
httponly = cookie1.httponly

cookie1.name     = &#39;name&#39;
cookie1.value    = [&#39;value1&#39;, &#39;value2&#39;, ...]
cookie1.path     = &#39;path&#39;
cookie1.domain   = &#39;domain&#39;
cookie1.expires  = Time.now + 30
cookie1.secure   = true
cookie1.httponly = true</pre>

    </section>

      <section id="5Buntitled-5D" class="documentation-section">


      <section class="constants-list">
      <header>
      <h3>Constants</h3>
      </header>
      <dl>
          <dt id="DOMAIN_VALUE_RE">DOMAIN_VALUE_RE
          <dd>
          <dt id="PATH_VALUE_RE">PATH_VALUE_RE
          <dd>
          <dt id="TOKEN_RE">TOKEN_RE
          <dd>
        </dl>
        </section>

        <section class="attribute-method-details" class="method-section">
        <header>
        <h3>Attributes</h3>
        </header>

          <div id="attribute-i-domain" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">domain</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              <p>Domain for which this cookie applies, as a <code>String</code></p>
              </div>
            </div>
          <div id="attribute-i-expires" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">expires</span><span
                class="attribute-access-type">[RW]</span>
            </div>

            <div class="method-description">
              <p>Time at which this cookie expires, as a <code>Time</code></p>
              </div>
            </div>
          <div id="attribute-i-httponly" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">httponly</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              <p>True if this cookie is httponly; false otherwise</p>
              </div>
            </div>
          <div id="attribute-i-name" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">name</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              <p>Name of this cookie, as a <code>String</code></p>
              </div>
            </div>
          <div id="attribute-i-path" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">path</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              <p>Path for which this cookie applies, as a <code>String</code></p>
              </div>
            </div>
          <div id="attribute-i-secure" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">secure</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              <p>True if this cookie is secure; false otherwise</p>
              </div>
            </div>
            </section>


                <section id="public-class-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Class Methods</h3>
                </header>

                  <div id="method-c-new" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          new(name_string,*value)
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>
                      <div class="method-heading">
                        <span class="method-callseq">
                          new(options_hash)
                              </span>
                            </div>

                            <div class="method-description">
                              <p>Create a new <a href="Cookie.html"><code>CGI::Cookie</code></a> object.</p>
<dl class="rdoc-list note-list"><dt><code>name_string</code>
<dd>
<p>The name of the cookie; in this form, there is no <a href="Cookie.html#attribute-i-domain"><code>domain</code></a> or expiration.  The <a href="Cookie.html#attribute-i-path"><code>path</code></a> is gleaned from the <code>SCRIPT_NAME</code> environment variable, and <a href="Cookie.html#attribute-i-secure"><code>secure</code></a> is false.</p>
</dd><dt><code>*value</code>
<dd>
<p>value or list of values of the cookie</p>
</dd><dt><code>options_hash</code>
<dd>
<p>A Hash of options to initialize this <a href="Cookie.html"><code>Cookie</code></a>.  Possible options are:</p>
<dl class="rdoc-list note-list"><dt>name
<dd>
<p>the name of the cookie.  Required.</p>
</dd><dt>value
<dd>
<p>the cookie’s value or list of values.</p>
</dd><dt>path
<dd>
<p>the path for which this cookie applies.  Defaults to the value of the <code>SCRIPT_NAME</code> environment variable.</p>
</dd><dt>domain
<dd>
<p>the domain for which this cookie applies.</p>
</dd><dt>expires
<dd>
<p>the time at which this cookie expires, as a <code>Time</code> object.</p>
</dd><dt>secure
<dd>
<p>whether this cookie is a secure cookie or not (default to false).  Secure cookies are only transmitted to HTTPS servers.</p>
</dd><dt>httponly
<dd>
<p>whether this cookie is a HttpOnly cookie or not (default to</p>
</dd></dl>

<pre>false).  HttpOnly cookies are not available to javascript.</pre>

<p>These keywords correspond to attributes of the cookie object.</p>
</dd></dl>
                                <div class="method-calls-super">
                                  Calls superclass method
                                  
                              </div>

                              <div class="method-source-code" id="new-source">
            <pre><span class="ruby-comment"># File cgi/cookie.rb, line 75</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>(<span class="ruby-identifier">name</span> = <span class="ruby-string">&quot;&quot;</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">value</span>)
  <span class="ruby-ivar">@domain</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-ivar">@expires</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">name</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">String</span>)
    <span class="ruby-keyword">self</span>.<span class="ruby-identifier">name</span> = <span class="ruby-identifier">name</span>
    <span class="ruby-keyword">self</span>.<span class="ruby-identifier">path</span> = (<span class="ruby-regexp">%r|\A(.*/)|</span> <span class="ruby-operator">=~</span> <span class="ruby-constant">ENV</span>[<span class="ruby-string">&quot;SCRIPT_NAME&quot;</span>] <span class="ruby-operator">?</span> <span class="ruby-node">$1</span> <span class="ruby-operator">:</span> <span class="ruby-string">&quot;&quot;</span>)
    <span class="ruby-ivar">@secure</span> = <span class="ruby-keyword">false</span>
    <span class="ruby-ivar">@httponly</span> = <span class="ruby-keyword">false</span>
    <span class="ruby-keyword">return</span> <span class="ruby-keyword">super</span>(<span class="ruby-identifier">value</span>)
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">options</span> = <span class="ruby-identifier">name</span>
  <span class="ruby-keyword">unless</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-string">&quot;name&quot;</span>)
    <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-string">&quot;`name&#39; required&quot;</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">name</span> = <span class="ruby-identifier">options</span>[<span class="ruby-string">&quot;name&quot;</span>]
  <span class="ruby-identifier">value</span> = <span class="ruby-constant">Array</span>(<span class="ruby-identifier">options</span>[<span class="ruby-string">&quot;value&quot;</span>])
  <span class="ruby-comment"># simple support for IE</span>
  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">path</span> = <span class="ruby-identifier">options</span>[<span class="ruby-string">&quot;path&quot;</span>] <span class="ruby-operator">||</span> (<span class="ruby-regexp">%r|\A(.*/)|</span> <span class="ruby-operator">=~</span> <span class="ruby-constant">ENV</span>[<span class="ruby-string">&quot;SCRIPT_NAME&quot;</span>] <span class="ruby-operator">?</span> <span class="ruby-node">$1</span> <span class="ruby-operator">:</span> <span class="ruby-string">&quot;&quot;</span>)
  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">domain</span> = <span class="ruby-identifier">options</span>[<span class="ruby-string">&quot;domain&quot;</span>]
  <span class="ruby-ivar">@expires</span> = <span class="ruby-identifier">options</span>[<span class="ruby-string">&quot;expires&quot;</span>]
  <span class="ruby-ivar">@secure</span> = <span class="ruby-identifier">options</span>[<span class="ruby-string">&quot;secure&quot;</span>] <span class="ruby-operator">==</span> <span class="ruby-keyword">true</span>
  <span class="ruby-ivar">@httponly</span> = <span class="ruby-identifier">options</span>[<span class="ruby-string">&quot;httponly&quot;</span>] <span class="ruby-operator">==</span> <span class="ruby-keyword">true</span>

  <span class="ruby-keyword">super</span>(<span class="ruby-identifier">value</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-parse" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">parse</span><span
                                class="method-args">(raw_cookie)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Parse a raw cookie string into a hash of cookie-name=&gt;Cookie pairs.</p>

<pre class="ruby"><span class="ruby-identifier">cookies</span> = <span class="ruby-constant">CGI</span><span class="ruby-operator">::</span><span class="ruby-constant">Cookie</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-string">&quot;raw_cookie_string&quot;</span>)
  <span class="ruby-comment"># { &quot;name1&quot; =&gt; cookie1, &quot;name2&quot; =&gt; cookie2, ... }</span>
</pre>

                              <div class="method-source-code" id="parse-source">
            <pre><span class="ruby-comment"># File cgi/cookie.rb, line 183</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">parse</span>(<span class="ruby-identifier">raw_cookie</span>)
  <span class="ruby-identifier">cookies</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>([])
  <span class="ruby-keyword">return</span> <span class="ruby-identifier">cookies</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">raw_cookie</span>

  <span class="ruby-identifier">raw_cookie</span>.<span class="ruby-identifier">split</span>(<span class="ruby-regexp">/;\s?/</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">pairs</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">name</span>, <span class="ruby-identifier">values</span> = <span class="ruby-identifier">pairs</span>.<span class="ruby-identifier">split</span>(<span class="ruby-string">&#39;=&#39;</span>,<span class="ruby-value">2</span>)
    <span class="ruby-keyword">next</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">name</span> <span class="ruby-keyword">and</span> <span class="ruby-identifier">values</span>
    <span class="ruby-identifier">values</span> <span class="ruby-operator">||=</span> <span class="ruby-string">&quot;&quot;</span>
    <span class="ruby-identifier">values</span> = <span class="ruby-identifier">values</span>.<span class="ruby-identifier">split</span>(<span class="ruby-string">&#39;&amp;&#39;</span>).<span class="ruby-identifier">collect</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-constant">CGI</span>.<span class="ruby-identifier">unescape</span>(<span class="ruby-identifier">v</span>,<span class="ruby-identifier">@@accept_charset</span>) }
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">cookies</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">name</span>)
      <span class="ruby-identifier">values</span> = <span class="ruby-identifier">cookies</span>[<span class="ruby-identifier">name</span>].<span class="ruby-identifier">value</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">values</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">cookies</span>[<span class="ruby-identifier">name</span>] = <span class="ruby-constant">Cookie</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">name</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">values</span>)
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">cookies</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

                <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Instance Methods</h3>
                </header>

                  <div id="method-i-domain-3D" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">domain=</span><span
                                class="method-args">(str)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Set domain for which this cookie applies</p>

                              <div class="method-source-code" id="domain-3D-source">
            <pre><span class="ruby-comment"># File cgi/cookie.rb, line 126</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">domain=</span>(<span class="ruby-identifier">str</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">str</span> <span class="ruby-keyword">and</span> ((<span class="ruby-identifier">str</span> = <span class="ruby-identifier">str</span>.<span class="ruby-identifier">b</span>).<span class="ruby-identifier">bytesize</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">255</span> <span class="ruby-keyword">or</span> <span class="ruby-operator">!</span><span class="ruby-constant">DOMAIN_VALUE_RE</span>.<span class="ruby-identifier">match?</span>(<span class="ruby-identifier">str</span>))
    <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-node">&quot;invalid domain: #{str.dump}&quot;</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-ivar">@domain</span> = <span class="ruby-identifier">str</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-httponly-3D" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">httponly=</span><span
                                class="method-args">(val)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Set whether the <a href="Cookie.html"><code>Cookie</code></a> is a httponly cookie or not.</p>

<p><code>val</code> must be a boolean.</p>

                              <div class="method-source-code" id="httponly-3D-source">
            <pre><span class="ruby-comment"># File cgi/cookie.rb, line 161</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">httponly=</span>(<span class="ruby-identifier">val</span>)
  <span class="ruby-ivar">@httponly</span> = <span class="ruby-operator">!</span><span class="ruby-operator">!</span><span class="ruby-identifier">val</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-inspect" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">inspect</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>A summary of cookie string.</p>

                              <div class="method-source-code" id="inspect-source">
            <pre><span class="ruby-comment"># File cgi/cookie.rb, line 202</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">inspect</span>
  <span class="ruby-node">&quot;#&lt;CGI::Cookie: #{self.to_s.inspect}&gt;&quot;</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-name-3D" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">name=</span><span
                                class="method-args">(str)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Set name of this cookie</p>

                              <div class="method-source-code" id="name-3D-source">
            <pre><span class="ruby-comment"># File cgi/cookie.rb, line 106</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">name=</span>(<span class="ruby-identifier">str</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">str</span> <span class="ruby-keyword">and</span> <span class="ruby-operator">!</span><span class="ruby-constant">TOKEN_RE</span>.<span class="ruby-identifier">match?</span>(<span class="ruby-identifier">str</span>)
    <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-node">&quot;invalid name: #{str.dump}&quot;</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-ivar">@name</span> = <span class="ruby-identifier">str</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-path-3D" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">path=</span><span
                                class="method-args">(str)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Set path for which this cookie applies</p>

                              <div class="method-source-code" id="path-3D-source">
            <pre><span class="ruby-comment"># File cgi/cookie.rb, line 116</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">path=</span>(<span class="ruby-identifier">str</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">str</span> <span class="ruby-keyword">and</span> <span class="ruby-operator">!</span><span class="ruby-constant">PATH_VALUE_RE</span>.<span class="ruby-identifier">match?</span>(<span class="ruby-identifier">str</span>)
    <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-node">&quot;invalid path: #{str.dump}&quot;</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-ivar">@path</span> = <span class="ruby-identifier">str</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-secure-3D" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">secure=</span><span
                                class="method-args">(val)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Set whether the <a href="Cookie.html"><code>Cookie</code></a> is a secure cookie or not.</p>

<p><code>val</code> must be a boolean.</p>

                              <div class="method-source-code" id="secure-3D-source">
            <pre><span class="ruby-comment"># File cgi/cookie.rb, line 153</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">secure=</span>(<span class="ruby-identifier">val</span>)
  <span class="ruby-ivar">@secure</span> = <span class="ruby-identifier">val</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">val</span> <span class="ruby-operator">==</span> <span class="ruby-keyword">true</span> <span class="ruby-keyword">or</span> <span class="ruby-identifier">val</span> <span class="ruby-operator">==</span> <span class="ruby-keyword">false</span>
  <span class="ruby-ivar">@secure</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-to_s" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">to_s</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Convert the <a href="Cookie.html"><code>Cookie</code></a> to its string representation.</p>

                              <div class="method-source-code" id="to_s-source">
            <pre><span class="ruby-comment"># File cgi/cookie.rb, line 166</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">to_s</span>
  <span class="ruby-identifier">val</span> = <span class="ruby-identifier">collect</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-constant">CGI</span>.<span class="ruby-identifier">escape</span>(<span class="ruby-identifier">v</span>) }.<span class="ruby-identifier">join</span>(<span class="ruby-string">&quot;&amp;&quot;</span>)
  <span class="ruby-identifier">buf</span> = <span class="ruby-node">&quot;#{@name}=#{val}&quot;</span>.<span class="ruby-identifier">dup</span>
  <span class="ruby-identifier">buf</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;; domain=#{@domain}&quot;</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@domain</span>
  <span class="ruby-identifier">buf</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;; path=#{@path}&quot;</span>     <span class="ruby-keyword">if</span> <span class="ruby-ivar">@path</span>
  <span class="ruby-identifier">buf</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;; expires=#{CGI.rfc1123_date(@expires)}&quot;</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@expires</span>
  <span class="ruby-identifier">buf</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">&quot;; secure&quot;</span>            <span class="ruby-keyword">if</span> <span class="ruby-ivar">@secure</span>
  <span class="ruby-identifier">buf</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">&quot;; HttpOnly&quot;</span>          <span class="ruby-keyword">if</span> <span class="ruby-ivar">@httponly</span>
  <span class="ruby-identifier">buf</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-value" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">value</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns the value or list of values for this cookie.</p>

                              <div class="method-source-code" id="value-source">
            <pre><span class="ruby-comment"># File cgi/cookie.rb, line 141</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">value</span>
  <span class="ruby-keyword">self</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-value-3D" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">value=</span><span
                                class="method-args">(val)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Replaces the value of this cookie with a new value or list of values.</p>

                              <div class="method-source-code" id="value-3D-source">
            <pre><span class="ruby-comment"># File cgi/cookie.rb, line 146</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">value=</span>(<span class="ruby-identifier">val</span>)
  <span class="ruby-identifier">replace</span>(<span class="ruby-constant">Array</span>(<span class="ruby-identifier">val</span>))
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

              </section>
              </main>



            </div>  <!--  class='wrapper hdiv' -->


<footer id="validator-badges" role="contentinfo">
<p><a href="https://validator.w3.org/check/referer">Validate</a></p>
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.4.0.</p>
<p>Based on <a href="https://github.com/ged/darkfish/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.</p>

  
    <p><p><a href="https://ruby-doc.org">Ruby-doc.org</a> is provided by <a href="https://jamesbritt.com">James Britt</a> and <a href="https://neurogami.com">Neurogami</a>. </p><p><a href="https://jamesbritt.bandcamp.com/">Hack your world.  Feed your head.  Live curious</a>.</p>
</p>
  
  </footer>

<script type="text/javascript">


  let ads  = $("#carbonads-container").children().detach();


  function swapMode() {
    var cookieName = 'darkmode';
    var cssDarkmode = Cookies.get(cookieName);
    console.log("***** swapMode! " + cssDarkmode + " *****");


    if (cssDarkmode == "true") {
      console.log("We have dark mode, set the css to light ...");
      $('#rdoccss').attr("href", defaultModeCssHref);
      $('#cssSelect').text("Dark mode");
      cssDarkmode = "false";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    } else {
      console.log("We not have dark mode, set the css to dark ...");
      $('#rdoccss').attr("href", darkModeCsseHref);
      $('#cssSelect').text("Light mode");
      cssDarkmode = "true";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    }

    console.log("  --------------- ");
  }


const vueCssApp = new Vue({
el: '#menubar',
data: {
isDark: false
},
methods: {
toggleClass: function(event){
this.isDark = !this.isDark;
}
}
})

const vueApp = new Vue({
el: '#vapp',
data: { 
isOpen: true
},

mounted() {
this.handleResize();
this.manage_mob_classes();
window.addEventListener('resize', this.handleResize)
//this.isOpen !=  (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},
destroyed() {
window.removeEventListener('resize', this.handleResize)
},
created() {
//manage_mob_classes();
},

methods : {
isMobile() {
  return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},

  handleResize() {
    if (!this.isMobile()) {
      this.isOpen = window.innerWidth > 800;
    }
  },

  manage_mob_classes() {
    if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
      $("nav").addClass("mob_nav");
      $("main").addClass("mob_main");
      $("#extraz").addClass("mob_extraz");
      $("#carbonads-container").addClass("mob_carbonads-container");
      this.isOpen  = false;
    } else {
      $("nav").removeClass("mob_nav") 
        $("main").removeClass("mob_main");
      $("#extraz").removeClass("mob_extraz");
      $("#carbonads-container").removeClass("mob_carbonads-container");
      this.isOpen  = true;
    }
  },

  toggleNav() {
    this.isOpen =! this.isOpen ;
    // alert("Toggle nav!");
    console.log("toggleNav() click: " + this.isOpen );
  }
}
})

$("#carbonads-container").append(ads);


$(function() {

    var darkmode = Cookies.get("darkmode");
    console.log("Document ready: " + darkmode);

    if ( darkmode  == "true" ) {
      $('#cssSelect').text("Light mode");
    } else {
      $('#cssSelect').text("Dark mode");
     }

    $('body').css('display','block');
    });

</script>

    
  </body> 
</html>

